package edu.lingnan.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import edu.lingnan.mapper.ProductMapper;
import edu.lingnan.pojo.Product;
import edu.lingnan.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product>
    implements ProductService{

    @Autowired
    private ProductMapper productMapper;


    @Override
    public List<Product> selectAllProduct() {

        return productMapper.selectAllProduct();
    }

    @Override
    public List<Product> selectProductById(Long id) {
        return productMapper.selectProductById(id);
    }

    @Override
    public List<Product> selectProductByName(String name) {
        return productMapper.selectProductByName(name);
    }

    @Override
    public List<Product> selectProductLikeName(String name) {
        return productMapper.selectProductLikeName(name);
    }

    @Override
    public List<Product> selectProductByType(String type) {
        return productMapper.selectProductByType(type);
    }

    @Override
    public List<Product> selectProductByStoreId(Long id) {
        return productMapper.selectProductByStoreId(id);
    }

    @Override
    public int deleteProductById(Long id) {
        return productMapper.deleteProductById(id);
    }

    @Override
    public int deleteProductByIds(Long[] ids) {
        return productMapper.deleteProductByIds(ids);
    }

    @Override
    public int updateProductStatus(Long id, int status) {
        return productMapper.updateProductStatus(id,status);
    }

    @Override
    public int updateProduct(Product product) {
        return productMapper.updateProduct(product);
    }

    @Override
    public Long addProduct(Product product) {
        productMapper.addProduct(product);
        return product.getId();
    }


}




